<template>
  <div
    :class="{ view: true, 'active-view': hasActive }"
    style="
      font-size: 10px;
      user-select: text !important;
      overflow: hidden;
      height: 100%;
    "
    :style="{ '--theme': $store.getters.themeColor }"
    @click="clickWarnn()"
  >
    <div style="cursor: pointer">
      <el-row class="one" style="margin-bottom: 15px" type="flex" justify="end">
        <el-col :span="24">
          <span
            class="one-title spanStyle"
            style="text-align: left"
            :title="viewDataSouse.alarmBody"
          >
            <span style="float: left" class="alarm-body">{{
              viewDataSouse.alarmBody
            }}</span>
            <div
              style="margin-left: 10px; width: 24px; float: left"
              :style="{
                'text-align': 'center',
                display: viewDataSouse.ifTimeout === 0 ? 'none' : 'block',
              }"
            >
              <div class="one-chao">超</div>
            </div>
            <div
              style="margin-left: 10px; width: 24px; float: left"
              :style="{
                'text-align': 'center',
                display: viewDataSouse.leaderNum === 0 ? 'none' : 'block',
              }"
            >
              <div class="one-pi">批</div>
            </div>
          </span>
        </el-col>
        <img
          @contextmenu.prevent="disableContextmenu"
          v-show="!isMyCollection"
          style="position: absolute; right: -36px; top: -39px"
          :src="getImgUrl()"
        />
      </el-row>
      <el-row class="two">
        <el-col :span="10" style="position: relative">
          <el-tooltip
            placement="right"
            effect="light"
            :visible-arrow="false"
            :enterable="false"
            popper-class="el-popover-img-pop"
            :offset="(index + 1) % 3 === 0 ? 150 : -150"
          >
            <el-image
              @contextmenu.prevent.native="disableContextmenu"
              fit="cover"
              style="height: 105px; width: 100%; border-radius: 2px"
              @click.stop="clickView(viewDataSouse)"
              :src="imgUrl"
            >
              <div slot="placeholder" class="image-slot">
                加载中<span class="dot">...</span>
              </div>
            </el-image>
            <div slot="content">
              <el-image
                @contextmenu.prevent.native="disableContextmenu"
                fit="cover"
                class="table-img"
                :src="imgUrl"
              >
                <div slot="placeholder" class="image-slot">
                  加载中<span class="dot">...</span>
                </div>
              </el-image>
            </div>
          </el-tooltip>
          <span class="stateType"
            >{{ "来自" + viewDataSouse.warningSourceName }}&nbsp;&nbsp;</span
          >
        </el-col>
        <el-col
          :offset="1"
          :span="13"
          id="r_view"
          style="
            margin-top: -3px;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            height: 105px;
          "
        >
          <el-row class="row">
            <el-col :span="24">
              <div class="viewTitleStyle">
                <el-tooltip
                  placement="top"
                  popper-class="event-tooltip"
                  :open-delay="800"
                >
                  <div slot="content" class="tooltip-content">告警类型</div>
                  <i class="iconfont icon-fenlei-leixing"></i>
                </el-tooltip>

                <div class="value">{{ viewDataSouse.warningTypeName }}</div>
                <div
                  class="status tag1"
                  v-if="viewDataSouse.importanceLevel === '1'"
                >
                  {{ viewDataSouse.importanceLevelName }}
                </div>
                <div
                  class="status tag2"
                  v-if="viewDataSouse.importanceLevel === '2'"
                >
                  {{ viewDataSouse.importanceLevelName }}
                </div>
                <!--                <div class="status">{{viewDataSouse.emergencyLevelName}}</div>-->
              </div>
            </el-col>
          </el-row>
          <el-row class="row">
            <div class="viewTitleStyle">
              <el-tooltip
                placement="top"
                popper-class="event-tooltip"
                :open-delay="800"
              >
                <div slot="content" class="tooltip-content">所属网格</div>
                <i class="iconfont icon-wangge"></i>
              </el-tooltip>
              <div class="value">{{ viewDataSouse.gridName }}</div>
            </div>
          </el-row>
          <el-row class="row">
            <div class="viewTitleStyle">
              <el-tooltip
                placement="top"
                popper-class="event-tooltip"
                :open-delay="800"
              >
                <div slot="content" class="tooltip-content">事发地点</div>
                <i class="iconfont icon-dizhi"></i>
              </el-tooltip>
              <el-tooltip
                placement="top"
                popper-class="event-tooltip"
                :open-delay="800"
              >
                <div slot="content" class="tooltip-content">
                  {{ viewDataSouse.address }}
                </div>
                <div class="value">{{ viewDataSouse.address }}</div>
              </el-tooltip>
            </div>
          </el-row>
          <!--          <el-row class="row">-->
          <!--            <div class="title">-->
          <!--              处理人:-->
          <!--              <div class="value">{{viewDataSouse.processName}}</div>-->
          <!--            </div>-->
          <!--          </el-row>-->
          <el-row
            class="row"
            :style="
              viewDataSouse.orderStatus != '6' &&
              viewDataSouse.orderStatus != '0' &&
              viewDataSouse.orderStatus != '7'
                ? ''
                : 'display:none'
            "
          >
            <div class="viewTitleStyle">
              <el-tooltip
                placement="top"
                popper-class="event-tooltip"
                :open-delay="800"
              >
                <div slot="content" class="tooltip-content">处理时长</div>
                <i class="iconfont icon-daojishi1"></i>
              </el-tooltip>
              <div class="value">
                {{ viewDataSouse.duration }}
              </div>
            </div>
          </el-row>
          <el-row
            class="alarm-tags-wrapper"
            style="display: flex; flex-wrap: nowrap; align-items: center"
            v-if="
              Array.isArray(viewDataSouse.alarmLableRelDTOList) &&
              viewDataSouse.alarmLableRelDTOList.length > 0
            "
          >
            <el-tooltip
              placement="top"
              popper-class="event-tooltip"
              :open-delay="800"
            >
              <div slot="content" class="tooltip-content">告警标签</div>
              <svg-icon
                icon-class="tag-icon"
                style="min-width: 14px; height: 22px; margin-right: 5px"
              ></svg-icon>
            </el-tooltip>
            <div class="view-tags" :title="tagsNum">
              <div
                v-for="(item, index) in viewDataSouse.alarmLableRelDTOList"
                :key="item.lableId"
              >
                <div class="item-tag" v-if="index < tagIndex">
                  {{ item.lableName }}
                </div>
              </div>
              <div
                v-if="tagIndex != 20"
                style="line-height: 22px; margin-left: -5px"
              >
                ...
              </div>
            </div>
          </el-row>
        </el-col>
      </el-row>
      <el-row class="row">
        <div
          class="viewTitleStyle"
          style="display: flex; align-items: center"
          @click.stop="clickView(viewDataSouse)"
        >
          <el-tooltip
            placement="top"
            popper-class="event-tooltip"
            :open-delay="800"
          >
            <div slot="content" class="tooltip-content">事件编号</div>
            <i class="iconfont icon-bianma1" style="line-height: 20px"></i>
          </el-tooltip>
          <div style="color: #1890ff" class="value">
            {{ viewDataSouse.orderId }}
          </div>
        </div>
      </el-row>
      <el-row class="three">
        <el-row class="row">
          <div class="line2"></div>
        </el-row>
        <el-row class="row">
          <el-col :span="12">
            <div
              class="viewTitleStyle"
              style="color: #666666; display: flex; align-items: center"
            >
              <el-tooltip
                placement="top"
                popper-class="event-tooltip"
                :open-delay="800"
              >
                <div slot="content" class="tooltip-content">告警时间</div>
                <i class="iconfont icon-shijian"></i>
              </el-tooltip>
              <div class="value">{{ timeStr(viewDataSouse.alarmTime) }}</div>
            </div>
          </el-col>
          <el-col :span="12" style="text-align: end">
            <div
              class="viewTitleStyle receiveTime"
              style="color: #666666; display: flex; align-items: center"
            >
              <el-tooltip
                placement="top"
                popper-class="event-tooltip"
                :open-delay="800"
              >
                <div slot="content" class="tooltip-content">接收时间</div>
                <i class="iconfont icon-shizhong"></i>
              </el-tooltip>
              <div class="value">{{ timeStr(viewDataSouse.reciveTime) }}</div>
            </div>
          </el-col>
        </el-row>
      </el-row>
    </div>
    <div class="view-footer">
      <!-- <div class="checkbox">
        <el-checkbox size="medium" v-model="clicked" @change="clickWarnn()" />
      </div> -->
      <div>
        <!-- v-if="collectAble" -->
        <div
          v-hasPermi="['event:alarm:collect']"
          class="collect-btn"
          @click.stop="
            changeCollectStatus(
              viewDataSouse.orderId,
              viewDataSouse.alarmTime,
              viewDataSouse.isCollection
            )
          "
        >
          <i
            class="iconfont icon-yishoucang"
            v-if="viewDataSouse.isCollection === '1'"
            style="color: #f9b500; font-size: 18px"
          ></i>
          <i
            v-if="viewDataSouse.isCollection !== '1'"
            class="iconfont icon-weishoucang1"
            style="font-size: 18px"
          ></i>
          <span>收藏</span>
        </div>
      </div>
      <div class="view-footer-right">
        <div
          class="timeout-desc"
          style="text-align: end; height: 28px; line-height: 28px"
        >
          <span
            v-show="!isMyCollection"
            :style="{
              color: viewDataSouse.ifTimeout === 1 ? 'var(--theme)' : '#4A90E2',
            }"
            >{{ viewDataSouse.showTime }}</span
          >
        </div>
        <el-button
          v-if="isShowByEventWait && btnName"
          type="primary"
          class="buttonClass el-button-Query"
          @click.stop="btnClickFun(viewDataSouse)"
          v-hasPermi="authority()"
          v-show="
            this.viewDataSouse.orderStatus !== '0' &&
            this.viewDataSouse.orderStatus !== '6' &&
            this.viewDataSouse.orderStatus !== '7'
          "
          :style="{
            cursor: viewDataSouse.ifEdit == '0' ? 'not-allowed' : 'pointer',
          }"
          ><span>{{ btnName }}</span>
        </el-button>
      </div>
    </div>
  </div>
</template>

<script>
import demoImg from "@/assets/image/demoImg.png";
import $ from "jquery";
import { DateFormat } from "@/utils/public";
import {
  addWarningOrderCollection,
  delWarningOrderCollection,
  grabProcessOrder,
  getOrderList,
} from "@/api/modules/eventManagement/view";
import "@/assets/font/iconfont.css";
//待研判
import statusNeedJudged from "@/assets/image/svg/status-need-judged.svg";
//待认领
import statusNeedReceive from "@/assets/image/svg/status-need-receive.svg";
//待调度
import statusNeedDispatched from "@/assets/image/svg/status-need-dispatched.svg";
//待处置
import statusNeedDisposal from "@/assets/image/svg/status-need-disposal.svg";
//待核实
import statusNeedVerify from "@/assets/image/svg/status-need-verify.svg";
//已完结
import statusEnd from "@/assets/image/svg/status-end.svg";
import statusNeedAccept from "@/assets/image/svg/status-need-accept.svg";

export default {
  name: "eventView",
  data() {
    return {
      clicked: false,
      disabled: true,
      lineWidth: 345,
      btnName: "",
      tagIndex: 20,
    };
  },
  computed: {
    collectAble() {
      // let test = this.$store.getters.userInfo;
      // debugger
      // 可收藏能力
      // return $store.get('$loginInfo').source === '1';
      return this.$store.getters.userInfo.userType === "2";
    },
    hasActive() {
      return !!this.selectList.find(
        (item) => item.orderId === this.viewDataSouse.orderId
      );
    },
    imgUrl() {
      // 默认展示框图，没有框图才展示原图
      let url = "";
      if (this.viewDataSouse.fileImgUrlIcon) {
        url = this.viewDataSouse.fileImgUrlIcon;
      } else if (this.viewDataSouse.imgUrl) {
        url = this.viewDataSouse.imgUrl;
      } else {
        url = demoImg;
      }
      return url;
    },
    tagsNum() {
      let str = "";
      if (Array.isArray(this.viewDataSouse.alarmLableRelDTOList)) {
        this.viewDataSouse.alarmLableRelDTOList.map((item) => {
          str = str + "  " + item.lableName;
        });
      }
      return str;
    },
  },

  created() {
    this.getStatusIcon();
    // if (this.viewDataSouse.orderStatus === "1") {
    //   this.viewDataSouse.orderStatusUrl = statusNeedJudged;
    // } else if (this.viewDataSouse.orderStatus === "2") {
    //   //待调度
    //   this.viewDataSouse.orderStatusUrl = statusNeedDispatched;
    // } else if (this.viewDataSouse.orderStatus === "3") {
    //   //待认领
    //   this.viewDataSouse.orderStatusUrl = statusNeedReceive;
    // } else if (this.viewDataSouse.orderStatus === "4") {
    //   //待处置
    //   this.viewDataSouse.orderStatusUrl = statusNeedDisposal;
    // } else if (this.viewDataSouse.orderStatus === "5") {
    //   //待核实
    //   this.viewDataSouse.orderStatusUrl = statusNeedVerify;
    // } else {
    //   //已完结 6工单完成  7重复告警完成 假警
    //   this.viewDataSouse.orderStatusUrl = statusEnd;
    // }
    this.$nextTick(() => {
      // 停用选择
      document.onselectstart = new Function("event.returnValue=true");
    });
  },
  watch: {
    selectList: function (val) {
      this.updateClickStatus();
    },
    viewDataSouse: {
      handler() {
        this.$nextTick(() => {
          this.getShowTagIndex();
        });
      },
      deep: true,
      immediate: true,
    },
  },
  mounted() {
    this.updateStatus();
    this.updateClickStatus();
    this.$nextTick(() => {
      window.addEventListener(
        "resize",
        this.debounce(this.getShowTagIndex, 300)
      );
    });
  },
  methods: {
    getImgUrl() {
      if (this.viewDataSouse.enableAcceptanceMode === "1") {
        return statusNeedAccept; // 待受理
      }
      switch (this.viewDataSouse.orderStatus) {
        case "1": // 待研判
          return statusNeedJudged;
        case "2": // 待调度
          return statusNeedDispatched;
        case "3": // 待认领
          return statusNeedReceive;
        case "4": //待处置
          return statusNeedDisposal;
        case "5": //待核实
          return statusNeedVerify;
        default: //已完结 6工单完成  7重复告警完成 假警
          return statusEnd;
      }
    },
    updateClickStatus() {
      const index = this.selectList.findIndex(
        (item) => item.orderId == this.viewDataSouse.orderId
      );
      if (index >= 0) {
        this.clicked = true;
      } else {
        this.clicked = false;
      }
    },
    //批量的时候选中
    clickWarnn() {
      this.$emit("selectWarn", this.viewDataSouse);
    },
    changeCollectStatus(warningOrderId, alarmTime, isCollection) {
      const _this = this;
      if (isCollection === "0") {
        // 未收藏，调用收藏请求
        addWarningOrderCollection({
          warningOrderId,
          alarmTime,
        }).then((res) => {
          if (res.code === 200) {
            $message.success("收藏成功");
            _this.viewDataSouse.isCollection = "1";
            // _this.$emit("getViewDataSource");
          } else {
            $message.warning(res.mess);
          }
        });
      } else {
        delWarningOrderCollection({
          warningOrderId,
        }).then((res) => {
          if (res.code === 200) {
            $message.success("取消收藏成功");
            _this.viewDataSouse.isCollection = "0";
            // _this.$emit("getViewDataSource");
          } else {
            $message.warning(res.mess);
          }
        });
      }
    },
    autoHeight() {
      let height = $("#r_view").height() - 10;

      $(".leftpic").height(height);
    },
    open() {
      let _this = this;
      // let item = $store.get('$loginInfo');
      this.$confirm("是否认领此处理单？", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          let params = {
            orderId: _this.viewDataSouse.orderId,
          };
          grabProcessOrder(params).then((res) => {
            if (res.code === "200") {
              $message.success("认领处理单成功！");
              _this.getDetails(_this.viewDataSouse.orderId);
            } else {
              $message.warning(res.msg);
            }
          });
        })
        .catch(() => {
          // _this.$message({
          //   type: 'info',
          //   message: '取消认领'
          // });
        });
    },
    getDetails(id) {
      let _this = this;
      let params = {
        orderId: _this.viewDataSouse.orderId,
      };
      getOrderList(params).then((res) => {
        if (res.code === "200") {
          _this.viewDataSouse = result.data.list[0];
          _this.updateStatus();
        }
      });
      this.$emit("queryEventData", true);
    },
    authority() {
      let isshow = "";
      switch (this.viewDataSouse.orderStatus) {
        case "1":
          isshow = ["event:alarm:judge"];
          break;
        case "2":
          isshow = ["event:alarm:sch"];
          break;
        case "3":
          isshow = ["event:alarm:claim"];
          break;
        case "4":
          isshow = ["event:alarm:dis"];
          break;
        case "5":
          isshow = ["event:alarm:ver"];
          break;
      }
      return isshow;
    },
    updateStatus() {
      if (this.viewDataSouse.enableAcceptanceMode === "1") {
        // 为1时为待受理
        this.btnName = "受 理";
        return;
      }
      switch (this.viewDataSouse.orderStatus) {
        case "0":
          this.btnName = "假 警"; //虚假告警完结
          break;
        case "1":
          this.btnName = "研 判";
          break;
        case "2":
          this.btnName = "调 度";
          break;
        case "3":
          this.btnName = "待认领"; //"待处置-部门";
          break;
        case "4":
          this.btnName = "处 置";
          break;
        case "5":
          this.btnName = "核 实";
          break;
        case "6":
          this.btnName = "工单完成";
          break;
        case "7":
          this.btnName = "重复告警"; //重复告警完成
          break;
        default:
          this.btnName = this.viewDataSouse.orderStatusName;
          break;
      }

      this.autoHeight();
    },

    eventName(val) {
      if (val != "") {
        return "/ " + val;
      }
    },
    timeStr(str) {
      return DateFormat.utcTimeToStrTime(str + "");
    },
    /**
     * 获取卡片中显示的标签索引
     */
    getShowTagIndex() {
      let wrapper = document.querySelector(".alarm-tags-wrapper"); // 外层元素
      let wrapperWidth;
      if (!Array.isArray(this.viewDataSouse.alarmLableRelDTOList)) {
        return;
      }
      if (!wrapper) {
        return;
      }
      wrapperWidth = wrapper.offsetWidth - 19; // 19为icon占用宽度
      let numWidth = 0;
      let tagIndex = 20;
      //计算标签占用总宽度，直接获取较多标签DOM耗费性能
      for (let i = 0; i < this.viewDataSouse.alarmLableRelDTOList.length; i++) {
        let itemWidth =
          this.viewDataSouse.alarmLableRelDTOList[i].lableName.length * 12 + 12; // 第一个12为字体大小   第二个12为margin
        numWidth = numWidth + itemWidth + 2 + 16; // 2 为border  16 为padding
        if (numWidth > wrapperWidth) {
          // 当显示的标签总宽度大于视口宽度返回当前标签索引
          tagIndex = i;
          break;
        }
      }
      this.tagIndex = tagIndex;
    },
    debounce(func, delay) {
      let timer = null;
      return function () {
        if (timer) {
          clearTimeout(timer);
        }

        timer = setTimeout(() => {
          func(this, arguments);
          timer = null;
        }, delay);
      };
    },
    /**
     * 获取卡片右上角状态图标
     * */
    getStatusIcon() {
      if (this.viewDataSouse.enableAcceptanceMode === "1") {
        this.viewDataSouse.orderStatusUrl = statusNeedAccept; // 待受理
        return;
      }
      switch (this.viewDataSouse.orderStatus) {
        case "1": // 待研判
          this.viewDataSouse.orderStatusUrl = statusNeedJudged;
          break;
        case "2": // 待调度
          this.viewDataSouse.orderStatusUrl = statusNeedDispatched;
          break;
        case "3": // 待认领
          this.viewDataSouse.orderStatusUrl = statusNeedReceive;
          break;
        case "4": //待处置
          this.viewDataSouse.orderStatusUrl = statusNeedDisposal;
          break;
        case "5": //待核实
          this.viewDataSouse.orderStatusUrl = statusNeedVerify;
          break;
        default: //已完结 6工单完成  7重复告警完成 假警
          this.viewDataSouse.orderStatusUrl = statusEnd;
      }
    },
    disableContextmenu() {
      return false;
    },
    // queryInfo() {
    //   if (this.viewDataSouse.ifEdit == "1") {
    //     if (this.viewDataSouse.orderStatus == "3") {
    //       // $v.message({
    //       //   message: '请到“铁塔视联平台app”认领处理单！'
    //       // });
    //       // return;
    //       this.open();
    //     } else if (this.viewDataSouse.orderStatus === "1") {
    //        // 研判、调度、处置、核实、详情
    //       this.$linkto("/eventLinks", {
    //         orderId: this.viewDataSouse.orderId,
    //         orderStatus: this.viewDataSouse.orderStatus,
    //         pageType: this.pageType,
    //         list: JSON.stringify(this.listData.filter(ele => ele.orderStatus === '1')),
    //       });
    //       this.$linkto("/eventLinks", {
    //         orderId: row.orderId,
    //         orderStatus: row.orderStatus,
    //         pageType: this.isMyEvent,
    //         searchParams: JSON.stringify(this.searchParams),
    //         fromPageType: this.isMyEvent ? 'myEvent' : 'eventManagement',
    //       });
    //     } else {
    //       let params = {
    //         appVerCode: this.viewDataSouse.appVerCode,
    //         linkId: this.viewDataSouse.linkId,
    //         status: 1,
    //       };
    //       querySysLinkViewUrl(params).then((res) => {
    //         if (res.code === 200 && res.data) {
    //           this.$router.push({
    //             path: "/" + res.data[0].pcUrl,
    //             query: {
    //               orderId: this.viewDataSouse.orderId,
    //             },
    //           });
    //         } else {
    //           this.$message.warning(res.msg);
    //         }
    //       });
    //     }
    //   }
    // },
    // clickView() {
    //   // $v.jumpMenuKeep(
    //   //   this,
    //   //   '/eventDetails?orderId=' +
    //   //     this.viewDataSouse.orderId +
    //   //     '&type=0' +
    //   //     '&orderStatus=' +
    //   //     this.viewDataSouse.orderStatus,
    //   //   true
    //   // );
    //   this.$linkto("/eventDetails", {
    //     orderId: this.viewDataSouse.orderId,
    //     type: 0,
    //     orderStatus: this.viewDataSouse.orderStatus,
    //     pageType: this.pageType,
    //     // list: JSON.stringify(this.listData),
    //   });
    //   // this.$router.push({
    //   //   path: "/eventDetails",
    //   //   query: {
    //   //     orderId: this.viewDataSouse.orderId,
    //   //     type: 0,
    //   //     orderStatus: this.viewDataSouse.orderStatus,
    //   //     pageType: this.pageType,
    //   //   },
    //   // });
    // },
  },
  props: {
    isShowByEventWait: {
      type: Boolean,
      default: true,
    },
    pageType: {
      type: Boolean,
      default: false,
    },
    btnType: {
      default: "1",
    },
    viewDataSouse: {
      type: Object,
      default: function () {
        return {
          alarmBody: "非法闯入",
          gridName: "",
          warningTypeName: "",
          orderId: "27175013912150071",
          latitude: "346.1232",
          warningOrderId: "27175013912150067",
          orderStatus: "2",
          description: "",
          remark: "",
          keeperId: "",
          video: {
            fileCode: "111111",
            fileName: "vediotest",
            startTime: "2021-05-18 09:14:55",
            endTime: "2021-05-18 09:14:57",
            recordType: 1,
            fileImageUrl: "http://dwdwdwdwd",
            warningOrderId: "27175013912150067",
          },
          findMobile: "",
          warningSource: "1",
          duration: "266天22小时59分钟",
          orderStatusName: "派单中",
          cityName: "",
          emergencyLevel: "",
          tenantName: "",
          keeperName: "",
          emergencyLevelName: "",
          countyName: "",
          longitude: "234.12",
          createDate: "2021-05-11T10:47:55.000+0000",
          imgs: [
            {
              fileCode: "111",
              fileName: "test",
              fileUrl: "http://dwadwadadawdawdawd",
              warningOrderId: "27175013912150067",
            },
          ],
          address: "",
          findName: "",
          expectTime: "",
          reciveTime: "",
          ifEdit: true,
          alarmTime: "2020-08-27T18:32:52.000+0000",
          warningTypeId: "1001",
          tenantId: "252D35113E5B4F5A8D063957567E9194",
          gridId: "",
          provinceName: "",
        };
      },
    },
    selectList: {
      type: Array,
      default: () => [],
    },
    pageSize: {
      type: Number,
      default: 6,
    },
    pageNum: {
      type: Number,
      default: 1,
    },
    index: {
      type: Number,
      default: 0,
    },
    clickView: {
      // 查看详情
      type: Function,
      default: () => {},
    },
    btnClickFun: {
      // 调度、研判等
      type: Function,
      default: () => {},
    },
    listData: {
      type: Array,
      default: () => [],
    },
    isMyCollection: {
      type: Boolean,
      default: false,
    },
  },
};
</script>

<style lang="scss">
// .el-popover-img-pop {
//   height: 350px;
//   .leftpic {
//     height: 100px !important;
//   }
// }

.el-tooltip__popper.el-popover-img-pop.is-light {
  height: 350px;
  background: transparent;
  border: none;

  .leftpic {
    height: 100px !important;
  }
}
</style>
<style lang="scss" scoped>
$theme: var(--theme);

.table-img {
  margin: 0px -40px 0px -40px;
  width: 500px;
  height: 282px;
  box-shadow: 0px 2px 12px 0px rgba(0, 0, 0, 0.06);
  border-radius: 2px;
}

.active-view {
  border-color: $theme !important;
  //box-shadow: 4px 4px 4px #d5d5d5;
  box-shadow: 0px 10px 12px 3px rgba(187, 187, 187, 0.55);
}

.checkbox >>> .el-checkbox__inner {
  height: 25px;
  width: 25px;
}

.checkbox >>> .el-checkbox__inner::after {
  height: 21px;
  width: 9px;
  border: 3px solid #fff;
  top: -2px;
  left: 6px;
  border-left: 0;
  border-top: 0;
}

html {
  font-size: 62.5%;
}

body {
  font-size: 1.4rem;
}

.view {
  background: rgba(255, 255, 255, 0.85) !important;
  border-radius: 5px !important;
  border: 1px solid #d6d6d6;
  // box-shadow: 0 10px 12px 3px rgba(213, 210, 233, 0.55) !important;
  padding: 18px 16px 16px !important;
  cursor: pointer !important;
}

.one-title {
  height: 24px;
  font-size: 18px;
  line-height: 24px;
  color: #333333;
  text-align: center;
}

.one-state {
  width: 100%;
  height: 20px;
  font-weight: 400;
  color: #ffffff;
  line-height: 19px;
  text-align: center;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 4px 6px 1px rgba(213, 210, 233, 0.55);
  border-radius: 4px;
  background: #f5a623;
}

.one-chao {
  text-align: center;
  width: 24px;
  height: 24px;
  font-weight: 400;
  font-size: 14px;
  color: #ffffff;
  line-height: 24px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  text-shadow: 0 4px 6px #d5d2e9;
  background: $theme;
}

.one-pi {
  width: 24px;
  height: 24px;
  font-weight: 400;
  font-size: 14px;
  color: #ffffff;
  line-height: 24px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  text-shadow: 0 4px 6px #d5d2e9;
  background: #d8a7dd;
}

.line1 {
  height: 1px;
  border: 1px dashed #b4bdc5;
}

.line2 {
  height: 1px;
  border: 1px dashed #b4bdc5;
  margin: 5px 0 7px 0;
}

.row {
  //margin-bottom: 0.3rem;
}

.btnStyle {
  color: #ffffff;
  width: 100%;
  background: $theme;
  border-radius: 12px;
  cursor: pointer;
  font-size: 10px;
}

.viewTitleStyle {
  float: left !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  width: 100%;
  font-size: 14px;
  font-weight: 400;
  color: #98a0a7;
  display: flex;
  flex-wrap: nowrap;
  line-height: 22px;
  height: 22px;

  &.receiveTime {
    justify-content: flex-end;
  }
}

.viewTitleStyle .status {
  display: inline-block;
  border-radius: 2px;
  padding: 0 6px;
  margin-left: 5px;
  text-align: center;
  vertical-align: middle;
  line-height: 20px;
  width: 38px;
}

.viewTitleStyle .tag1 {
  background: $theme;
  color: #fff;
}

.viewTitleStyle .tag2 {
  background: #e3bd11;
  color: #fff;
}

.viewTitleStyle .tag3 {
  background: rgba(248, 120, 50, 1);
  color: #fff;
}

.viewTitleStyle .tag4 {
  background: rgba(251, 46, 60, 1);
  color: #fff;
}

.viewTitleStyle .iconfont {
  font-size: 14px !important;
  line-height: 22px;
  display: inline-block;
}

.viewTitleStyle .value {
  float: left !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  //width: 100%;
  font-weight: 400;
  color: #666666;
  display: inline-block;
  margin-left: 5px;
}

.clickStyle {
  cursor: pointer;
  color: #0d8bff;
}

.leftpic {
  height: 100%;
  width: 100%;
  object-fit: cover;
}

.view-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;

  .collect-btn {
    width: 66px;
    height: 24px;
    display: flex;
    align-items: center;
    font-size: 14px;
    font-weight: 400;
    color: #666666;

    > i {
      font-size: 24px;
      margin-right: 6px;
    }
  }

  .view-footer-right {
    display: flex;
    justify-content: end;
    font-size: 14px;
    align-items: center;
    min-width: 210px;

    .timeout-desc {
      text-align: end;
      height: 28px;
      line-height: 28px;
      padding: 0 5px;
    }
  }
}

.buttons {
  display: flex;
  justify-content: center;
}

.buttonClass {
  min-width: 76px;
  height: 28px;
  line-height: 28px;
  /*height: 4.5vh;*/
  background: $theme;
  // border-radius: 12px;
  border: 1px solid $theme;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  margin-right: 0px;
  font-size: 14px !important;
}

.c-home .buttons .buttonClass.el-button-Query {
  margin: 0 !important;
  padding: 0 !important;
}

span,
div {
  /*font-family: PingFangSC-Regular, PingFang SC !important;*/
}

.spanStyle {
  white-space: nowrap;
  /*强制span不换行*/
  display: inline-block;
  /*将span当做块级元素对待*/
  width: 100%;
  /*限制宽度*/
  overflow: hidden;
  /*超出宽度部分隐藏*/
  text-overflow: ellipsis;
  /*超出部分以点号代替*/
}

.stateType {
  padding: 2px 1px 2px 5px;
  font-size: 12px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #ffffff;
  line-height: 20px;
  background: rgba(65, 117, 5, 0.58);
  border-radius: 0px 3px 3px 0px;
  position: absolute;
  bottom: 10px;
  left: 0px;
}

.el-button:focus,
.el-button:hover {
  color: #ffffff;
  border-color: $theme;
  background-color: $theme;
  -webkit-box-shadow: 0 5px 5px 1px rgba(255, 106, 108, 0.25) !important;
  box-shadow: 0 5px 5px 1px rgba(255, 106, 108, 0.25) !important;
}
.view-tags {
  display: flex;
  flex-wrap: nowrap;
  flex: 1;
}
.item-tag {
  font-size: 12px;
  height: 22px;
  font-size: 12px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #ff4d4f;
  line-height: 20px;
  background: #fff1f0;
  border-radius: 2px;
  border: 1px solid #ffa39e;
  margin-right: 12px;
  padding: 0px 8px;
  white-space: nowrap;
}
.alarm-body {
  max-width: calc(100% - 80px);
  overflow: hidden;
  text-overflow: ellipsis;
}
/*.c-home .el-button--primary:focus, .c-home .el-button--primary:hover, .el-message-box__btns .el-button--primary:hover {*/
/*  color: #fff!important;*/
/*  background: #FF5052!important;*/
/*  border-color: #FF5052!important;*/
/*  -webkit-box-shadow: 0 5px 5px 1px rgba(255, 106, 108, 0.25)!important;*/
/*  box-shadow: 0 5px 5px 1px rgba(255, 106, 108, 0.25)!important;*/
/*}*/

/*@media all*/
/*and (-moz-min-device-pixel-ratio: 1.09) and (-moz-max-device-pixel-ratio: 1.18),*/
/*(-webkit-min-device-pixel-ratio: 1.09) and (-webkit-max-device-pixel-ratio: 1.18),*/
/*(min-resolution: 1.09dppx) and (max-resolution: 1.18dppx) {*/
/*  :root {*/
/*    font-size: 14px;*/
/*  }*/
/*}*/
/*@media all*/
/*and (-moz-min-device-pixel-ratio: 1.19) and (-moz-max-device-pixel-ratio: 1.28),*/
/*(-webkit-min-device-pixel-ratio: 1.19) and (-webkit-max-device-pixel-ratio: 1.28),*/
/*(min-resolution: 1.19dppx) and (max-resolution: 1.28dppx) {*/
/*  :root {*/
/*    font-size: 13px;*/
/*  }*/
/*}*/
/*@media all*/
/*and (-moz-min-device-pixel-ratio: 1.29) and (-moz-max-device-pixel-ratio: 1.4),*/
/*(-webkit-min-device-pixel-ratio: 1.29) and (-webkit-max-device-pixel-ratio: 1.4),*/
/*(min-resolution: 1.29dppx) and (max-resolution: 1.4dppx) {*/
/*  :root {*/
/*    font-size: 12px;*/
/*  }*/
/*}*/
/*@media all*/
/*and (-moz-min-device-pixel-ratio: 1.41) and (-moz-max-device-pixel-ratio: 1.6),*/
/*(-webkit-min-device-pixel-ratio: 1.41) and (-webkit-max-device-pixel-ratio: 1.6),*/
/*(min-resolution: 1.41dppx) and (max-resolution: 1.6dppx) {*/
/*  :root {*/
/*    font-size: 10px;*/
/*  }*/
/*}*/
/*@media all*/
/*and (-moz-min-device-pixel-ratio: 1.61) and (-moz-max-device-pixel-ratio: 1.8),*/
/*(-webkit-min-device-pixel-ratio: 1.61) and (-webkit-max-device-pixel-ratio: 1.8),*/
/*(min-resolution: 1.61dppx) and (max-resolution: 1.8dppx) {*/
/*  :root {*/
/*    font-size: 9px;*/
/*  }*/
/*}*/
/*@media all*/
/*and (-moz-min-device-pixel-ratio: 1.81) and (-moz-max-device-pixel-ratio: 2.1),*/
/*(-webkit-min-device-pixel-ratio: 1.81) and (-webkit-max-device-pixel-ratio: 2.1),*/
/*(min-resolution: 1.81dppx) and (max-resolution: 2.1dppx) {*/
/*  :root {*/
/*    font-size: 8px;*/
/*  }*/
/*}*/
</style>
